<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <div id="app">
            <div>{{num}}</div>
            <button @click="play" :disabled='f'>开始</button>
        </div>
        <script src="js/vue.js"></script>
        <script>
            new Vue({
                el: "#app",
                data: {
                    num: 10,
                    f:true
                },
                mounted() {
                    setInterval(() => {
                        if (this.num > 0) {
                            this.num--;
                            if (this.num===0){
                                this.f=false}
                        }else {
                                this.f=false
                        }

                    }, 1000);
                },
                methods: {
                    play() {
                        this.num = 10;
                        this.f=true
                    }
                }
            })
        </script>
    </body>
</html>